﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace ApiData.Common
{
    /// <summary>
    /// 枚举
    /// </summary>
    public class EnumHelper
    {
        /// <summary>
        /// 获取由枚举生成的键值对
        /// </summary>
        /// <param name="enumType">枚举类型</param>
        /// <returns></returns>
        public static List<KeyValuePair<string, int>> GetSelectItems(Type enumType)
        {
            var dic = new Dictionary<string, int>();
            foreach (var item in Enum.GetValues(enumType))
            {
                dic.Add(item.ToString(), (int)item);
            }
            return dic.ToList();
        }
        /// <summary>
        /// 字段数据类型
        /// </summary>
        public enum FiledDataType
        {
            @string = 0,
            file = 1
        }
    }
}
